package org.erepublik.company.thread;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.erepublik.company.product.Food;
import org.erepublik.company.scanner.FoodScanner;

/**
 * Listener odpalany w tle na tomcacie.
 * Sluzy on do uaktualniania cen chleba
 *
 * @author Kacper Gorski 'Railman' railman85@gmail.com
 */
public class FoodListener implements ServletContextListener {

	public void contextDestroyed(ServletContextEvent arg0) {
	}

	public void contextInitialized(ServletContextEvent arg0) {
		System.out.println("odpalam watek updatujacy jedzenie...");
		ProductUpdater<Food> foodUpdater = new ProductUpdater<Food>("food", 1000*60*10, new FoodScanner());
		foodUpdater.start();
	}
	
}
